package com.xiangban.yanglaodajie_admin.controller;

import com.xiangban.yanglaodajie_admin.aop.Permission;
import com.xiangban.yanglaodajie_admin.dao.ClassOrAvtivityExpandMapper;
import com.xiangban.yanglaodajie_admin.entity.ClassMaterials;
import com.xiangban.yanglaodajie_admin.entity.ClassOutline;
import com.xiangban.yanglaodajie_admin.entity.ClassProgress;
import com.xiangban.yanglaodajie_admin.entity.Ids;
import com.xiangban.yanglaodajie_admin.entity.dto.ClassMaterialsDto;
import com.xiangban.yanglaodajie_admin.entity.res.ApiResult;
import com.xiangban.yanglaodajie_admin.service.ClassOrAvtivityExpandService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Mr. MaYaYun
 * @Data 2021/7/30 9:22
 */
@RestController
@RequestMapping("/api/admin/class_expand")
@ApiModel("课程拓展信息")
public class ClassOrAvtivityExpandController {

    @Autowired
    private ClassOrAvtivityExpandService classExpandService;


    @PostMapping("/addOrUpdClassMaterials")
    @ApiModelProperty("添加或修改课程教材")
    @Permission(permission = "admin:class_expand:addOrUpdClassMaterials")
    public ApiResult<Object> addOrUpdClassMaterials(@RequestBody ClassMaterialsDto classMaterialsDto){
        classExpandService.addOrUpdClassMaterials(classMaterialsDto);
        return ApiResult.newSuccess();
    }

    @PostMapping("/delClassMaterials")
    @ApiModelProperty("删除课程教材")
    @Permission(permission = "admin:class_expand:delClassMaterials")
    public ApiResult<Object> delClassMaterials(@RequestBody ClassMaterials classMaterials){
        classExpandService.delClassMaterials(classMaterials);
        return ApiResult.newSuccess();
    }



    @PostMapping("/addOrUpdClassOutline")
    @ApiModelProperty("添加或修改教学大纲")
    @Permission(permission = "admin:class_expand:addOrUpdClassOutline")
    public ApiResult<Object> addOrUpdClassMaterials(@RequestBody ClassOutline classOutline){
        classExpandService.addOrUpdClassOutline(classOutline);
        return ApiResult.newSuccess();
    }

    @PostMapping("/delClassOutline")
    @ApiModelProperty("可批量删除教学大纲")
    @Permission(permission = "admin:class_expand:delClassOutline")
    public ApiResult<Object> delClassOutline(@RequestBody Ids ids){
        classExpandService.delClassOutline(ids);
        return ApiResult.newSuccess();
    }


    @PostMapping("/addOrUpdClassProgress")
    @ApiModelProperty("添加或修改教学进度")
    @Permission(permission = "admin:class_expand:addOrUpdClassProgress")
    public ApiResult<Object> addOrUpdClassProgress(@RequestBody ClassProgress classProgress){
        classExpandService.addOrUpdClassProgress(classProgress);
        return ApiResult.newSuccess();
    }

    @PostMapping("/delClassProgress")
    @ApiModelProperty("可批量删除教学进度")
    @Permission(permission = "admin:class_expand:delClassProgress")
    public ApiResult<Object> delClassProgress(@RequestBody Ids ids){
        classExpandService.delClassProgress(ids);
        return ApiResult.newSuccess();
    }

}
